import {Component, NgZone} from '@angular/core';
import {Network} from "@ionic-native/network";
@Component({
    selector: 'network-bar',
    templateUrl: 'network-bar.html'
})
export class NetworkBar {
    offline:boolean=false;
    constructor(
        private ngZone:NgZone,
        private network: Network
    ) {
        network.onDisconnect().subscribe(()=>{
            ngZone.run(() => {  this.offline=true; });
        });
        network.onConnect().subscribe(()=>{
            ngZone.run(() => {  this.offline=false; });
        });
    }

}

